Skip to content

modify dubbo plugin configuration based on selector #5953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Jun 20, 2025

Conversation

Wweiei
Copy link
Contributor

@Wweiei Wweiei commented Mar 7, 2025

complete task 4 in #5923 , modify dubbo registry config base on selector.

  1. i add one parameter "registry" in dubbo selector, and change "protocol" to not required.
    image
  2. for example, change the shenyu-examples-apache-dubbo-service's dubbo.registry.address to 'nacos://localhost:8848?namespace=local_test&username=nacos&password=nacos'
    image
    if the dubbo selector parameter registry is empty, it will use the default plugin config. i add a common method to get the dubbo ReferenceConfig in ApacheDubboProxyService.java#getReferenceConfig
    image
    when invoke the api 'http://localhost:9195/dubbo/findById', it will throw No provider exception.
    image
  3. set the dubbo selector parameter to 'nacos://localhost:8848?namespace=local_test&username=nacos&password=nacos'
    image
    when invoke the api the 'dubboUpstreams' is not empty in ApacheDubboProxyService.java#getReferenceConfig
    image
    then chose one upstream and create a new ReferenceConfig with a new cacheKey
    image
    finally, it will use the new ReferenceConfig to invoke the dubbo interface through the new registry。
    image
  4. when build the ReferenceConfig in ApacheDubboConfigCache.java, it will use the new dubbo RegistryConfig and the dubbo rule config is not used in default model. so i wrote a new buildReference method。
    image
    And when use the multi registry or there are multiple Dubbo instances, the custom dubbo LoadBalance ApacheDubboGrayLoadBalance will be triggered, so when build the ReferenceConfig i didn't use reference.setLoadbalance("gray") and methodConfig.setLoadbalance("gray").

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

@Aias00
Copy link
Contributor

Aias00 commented Mar 20, 2025

@Wweiei if u got time, fix the conflicts

…g-base-on-selector

# Conflicts:
#	db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-ob.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-og.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-pg.sql
@Wweiei
Copy link
Contributor Author

Wweiei commented Mar 20, 2025

@Wweiei if u got time, fix the conflicts
ok, i have fixed it

@Aias00
Copy link
Contributor

Aias00 commented Mar 27, 2025

@Wweiei hi, fix the ci, pls

Wweiei and others added 2 commits March 28, 2025 09:00
…g-base-on-selector

# Conflicts:
#	db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-ob.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-og.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-pg.sql
@Aias00 Aias00 added this to the 2.7.0.1 milestone Mar 31, 2025
@Aias00
Copy link
Contributor

Aias00 commented Apr 10, 2025

@Wweiei fix ci pls

@Aias00 Aias00 requested a review from moremind April 10, 2025 12:08
Wweiei and others added 5 commits April 11, 2025 09:44
…g-base-on-selector

# Conflicts:
#	db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-ob.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-og.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-pg.sql
}

ReferenceConfig<GenericService> reference = new ReferenceConfig<>();
reference.setGeneric("true");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why "true"? not true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it set to "true", it means the generic invocation function is enabled.Otherwise, when initializing ReferenceConfig, the caller still needs to hold the Class object of the service interface.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 12 out of 22 changed files in this pull request and generated 1 comment.

Files not reviewed (10)
  • db/init/mysql/schema.sql: Language not supported
  • db/init/ob/schema.sql: Language not supported
  • db/init/og/create-table.sql: Language not supported
  • db/init/oracle/schema.sql: Language not supported
  • db/init/pg/create-table.sql: Language not supported
  • db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql: Language not supported
  • db/upgrade/2.7.0-upgrade-2.7.1-ob.sql: Language not supported
  • db/upgrade/2.7.0-upgrade-2.7.1-og.sql: Language not supported
  • db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql: Language not supported
  • db/upgrade/2.7.0-upgrade-2.7.1-pg.sql: Language not supported

@moremind moremind modified the milestones: 2.7.0.1, 2.7.0.2 Apr 24, 2025
@Aias00 Aias00 merged commit 9ac8659 into apache:master Jun 20, 2025
52 of 62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants